package com.jbp.controller;

import com.jbp.model.ArticleCommentLike;
import com.jbp.service.ArticleCommentLikeService;
import com.jbp.utils.PageUtils;
import com.jbp.utils.R;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Arrays;
import java.util.Map;

/**
 * 评论的点赞(ArticleCommentLike)表控制层
 * @author cc
 * @since 2020-08-25 14:37:34
 */
@Api(tags ="APP接口--动态-评论的点赞" )
@RestController
@ApiIgnore
@RequestMapping("rest/articleCommentLike")
public class ArticleCommentLikeController {
    @Autowired
    private ArticleCommentLikeService articleCommentLikeService;

    /** 列表 */
    /*@ApiOperation(value="列表")
    @ApiResponses({
            @ApiResponse(code = 200,message = "成功",response = ArticleCommentLike.class),
            @ApiResponse(code = 201,message = "返回失败信息")
    })
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = articleCommentLikeService.queryPage(params);
        return R.ok().put("page", page);
    }*/

    /** 保存 */
    @PostMapping("/like")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "commentId",value = "评论id",paramType = "body"),
            @ApiImplicitParam(name = "status",value = "状态 1 赞, 0 取消",paramType = "body"),
    })
    public R like(@RequestBody ArticleCommentLike articleCommentLike, @RequestAttribute("userId") Integer userId){
        articleCommentLike.setReaderId(userId);
        articleCommentLikeService.like(articleCommentLike);
        return R.ok();
    }
}